# coding=utf-8
'''
    广州赢思人力资源360评测系统
 version:1.0
'''
from django.db import models
from django.forms import ModelForm
from django import forms




#关键技能
class Skills(models.Model):
    title = models.CharField('内容',max_length=200)
    class Meta:
        verbose_name = '关键技能'
        verbose_name_plural = '关键技能'
    def __unicode__(self):
        return self.title

class Types(models.Model):
    title = models.CharField('分类名称',max_length=100)
    class Meta:
        verbose_name = '分类名称'
        verbose_name_plural = '分类名称'
    def __unicode__(self):
        return self.title



class Topic(models.Model):
    question = models.CharField('问题',max_length=100)
    types = models.ForeignKey(Types,verbose_name='分类名称')
    class Meta:
        verbose_name = '问题'
        verbose_name_plural = '问题'
    def __unicode__(self):
        return self.question


class Problem(models.Model):
    ANSWER_CHOICES = (
        (u'N', 'N'),
        (u'1', '1'),
        (u'2', '2'),
        (u'3', '3'),
        (u'4', '4'),
        (u'5', '5'),
    )
#    ANSWER_CHOICES = ((False,''),(True, '正确答案'))
    checkboxname = models.CharField('问题内容',max_length=100)
#    answer = models.BooleanField('是否是正确答案')
    answer = models.CharField('回答', choices=ANSWER_CHOICES,max_length=1, null =True, blank=True)
    topic = models.ForeignKey(Topic,verbose_name='问题')
    class Meta:
        verbose_name = '答案'
        verbose_name_plural = '答案'
    def __unicode__(self):
        return self.checkboxname

#class ProblemForm(ModelForm):
#    answer = forms.ChoiceField(label='正确答案',choices=((False,''),(True,'正确答案')), widget=forms.RadioSelect(),initial=False) 
#    class Meta:
#        model = Problem


    
class Checkpoint(models.Model):
    STATUS_CHOICES = (
        (u'BOSS', 'BOSS'),
        (u'OTHER', 'OTHER'),
        (u'SELF', 'SELF'),
    )
    S_CHOICES = (
        ( True,u'生效'),
        ( False,u'失效'),
    )
    title = models.CharField('公司名称',max_length=100)
    image = models.ImageField('公司logo',upload_to='photos/%Y/%m/%d', null =True, blank=True)
    welcome = models.TextField('给提供反馈者的信息', null =True, blank=True)
    readme = models.TextField('给提供反馈者的说明', null =True, blank=True)
    memo = models.TextField('如果你希望给测评者提供反馈。这个信息将提供给他，你可以在下面的格中填写。', null =True, blank=True)
    modeltype = models.CharField('模板类型', max_length=16, choices=STATUS_CHOICES, default='SELF')
    types = models.ManyToManyField(Types,verbose_name='分类名称')
    skills = models.ManyToManyField(Skills,verbose_name='关键技能')
    status = models.BooleanField('状态',choices=S_CHOICES,default='SELF')
    class Meta:
        verbose_name = '问卷模板'
        verbose_name_plural = '问卷模板'
    def __unicode__(self):
        return self.title